using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace DataWinner.Entity.Nba_Sina.Models.Mapping
{
    public class Match_SinaMap : EntityTypeConfiguration<Match_Sina>
    {
        public Match_SinaMap()
        {
            // Primary Key
            this.HasKey(t => t.MatchId);

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.MatchId)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.HomeTeamId)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.VisitingTeamId)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Match_Sina");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.MatchId).HasColumnName("MatchId");
            this.Property(t => t.SeasonYear).HasColumnName("SeasonYear");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.MatchTime).HasColumnName("MatchTime");
            this.Property(t => t.HomeTeamId).HasColumnName("HomeTeamId");
            this.Property(t => t.VisitingTeamId).HasColumnName("VisitingTeamId");
            this.Property(t => t.CreateBy).HasColumnName("CreateBy");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.ModifyBy).HasColumnName("ModifyBy");
            this.Property(t => t.ModifyTime).HasColumnName("ModifyTime");
            this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");

            // Relationships
            this.HasRequired(t => t.Team_Sina)
                .WithMany(t => t.Match_Sina)
                .HasForeignKey(d => d.HomeTeamId);
            this.HasRequired(t => t.Team_Sina1)
                .WithMany(t => t.Match_Sina1)
                .HasForeignKey(d => d.VisitingTeamId);

        }
    }
}
